import { Type } from 'class-transformer';
import { IsEmail, IsInt, IsMobilePhone, IsOptional, IsString } from 'class-validator';

export class ImageCaptchaDto {
  @Type(() => Number)
  @IsInt()
  @IsOptional()
  readonly width: number = 100;

  @Type(() => Number)
  @IsInt()
  @IsOptional()
  readonly height: number = 50;
}

export class SendEmailCodeDto {
  @IsEmail({}, { message: '邮箱格式不正确' })
  email: string;
}

export class SendSmsCodeDto {
  @IsMobilePhone('zh-CN', {}, { message: '手机号格式不正确' })
  phone: string;
}

export class CheckCodeDto {
  @IsString()
  account: string;

  @IsString()
  code: string;
}
